import requests


API_URL="https://api-inference.huggingface.co/models/uer/gpt2-chinese-cluecorpussmall"
API_TOKEN="hf_xxx"
headers = {"Authorization": "Bearer {}".format(API_TOKEN)}
# 不适用token 进行匿名访问
response=requests.post(API_URL,headers=headers,json={"inputs":"你好，中国，很高兴"})
print(response.json())

